package com.fsm.common.aviator;

import com.googlecode.aviator.AviatorEvaluator;
import com.googlecode.aviator.Expression;

import java.util.HashMap;
import java.util.Map;

public class TestAviator {

    public static void main(String[] args) {
        //创建一个数据
        Map<String, Object> map = new HashMap<>();
        map.put("host","1270.0.0.1");
        map.put("level","info");
        //创建一个表达式
        String rule = "level=='info'";
        // 编译表达式
        Expression compiledExp = AviatorEvaluator.compile(rule);
        //测试结果
        Boolean boo = Boolean.valueOf(compiledExp.execute(map).toString());
        System.out.println(boo);
    }

}
